package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.LumiereMemberWelfareSubscribeMapper;
import org.linlinjava.litemall.db.domain.LumiereMemberWelfareCoupon;
import org.linlinjava.litemall.db.domain.LumiereMemberWelfareCouponExample;
import org.linlinjava.litemall.db.domain.LumiereMemberWelfareSubscribe;
import org.linlinjava.litemall.db.domain.LumiereMemberWelfareSubscribeExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LumiereMemberWelfareSubscribeService {

    @Resource
    private LumiereMemberWelfareSubscribeMapper lumiereMemberWelfareSubscribeMapper;

    public void add(LumiereMemberWelfareSubscribe lumiereMemberWelfareSubscribe){
        lumiereMemberWelfareSubscribeMapper.insert(lumiereMemberWelfareSubscribe);
    }

    public void deleteByExample(LumiereMemberWelfareSubscribeExample example){
        lumiereMemberWelfareSubscribeMapper.deleteByExample(example);
    }

    public List<LumiereMemberWelfareSubscribe> findByMemberId(Integer memberId, Byte type){
        LumiereMemberWelfareSubscribeExample example = new LumiereMemberWelfareSubscribeExample();
        example.or().andMemberIdEqualTo(memberId).andMemberTypesEqualTo(type);
        return lumiereMemberWelfareSubscribeMapper.selectByExample(example);
    }
}
